<?php
/* SVN FILE: $Id: bankCache.php 231 2009-09-28 17:24:43Z supersmashbrothers $ */
/**
* ibMarket 2
* IP.Board 3.0
* ibMarket Cache functions
* ibMarket IPB cache functions
*
* @author $Author: supersmashbrothers $
* @copyright $Copyright$
* @version $Revision: 231 $
* @lastrevision $Date: 2009-09-28 17:24:43 +0000 (Mon, 28 Sep 2009) $
* @modifiedby $LastChangedBy: supersmashbrothers $
* @lastmodified $LastChangedDate: 2009-09-28 17:24:43 +0000 (Mon, 28 Sep 2009) $
* @filesource $URL: http://ipb-ibmarket.googlecode.com/svn/ibmarket2/trunk/admin/applications_addon/other/ibmarket/plugins/bank/bankCache.php $
*/

final class bankCache
{
	/**#@+
	 * Registry Object Shortcuts
	 *
	 * @access	protected
	 * @var		object
	 */
	protected $registry;
	protected $DB;
	protected $settings;
	protected $request;
	protected $lang;
	protected $member;
	protected $memberData;
	protected $cache;
	protected $caches;
	/**#@-*/
	
	/**
	 * Make the registry shortcuts
	 *
	 * @access	public
	 * @param	object	ipsRegistry reference
	 * @return	void
	 */
	public function makeRegistryShortcuts( ipsRegistry $registry )
	{
		/* Make registry objects */
		$this->registry   =  $registry;
		$this->DB         =  $this->registry->DB();
		$this->settings   =& $this->registry->fetchSettings();
		$this->request    =& $this->registry->fetchRequest();
		$this->lang       =  $this->registry->getClass('class_localization');
		$this->member     =  $this->registry->member();
		$this->memberData =& $this->registry->member()->fetchMemberData();
		$this->cache      =  $this->registry->cache();
		$this->caches     =& $this->registry->cache()->fetchCaches();
	}
	
	/**
	 * Rebuilds Bank cache
	 *
	 * @access	public
	 * @return	void
	 */
	public function cacheBank()
	{
		$cache = array();
		
		$this->DB->build(array('select'=>'*','from'=>'market_bank_starter'));
		$this->DB->execute();
		while($starter = $this->DB->fetch())
		{
			$cache[$starter['starter_id']] = $starter;
		}
		
		$this->cache->setCache( 'ibm_bank_starter', $cache, array( 'array' => 1, 'deletefirst' => 1, 'donow' => 0 ) );
	}
}
?>